/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package be;

import util.JSONObject;

/**
 *
 * @author Dikas
 */
public class WsData {

    private Request objRequest;
    private Response objResponse;

    public WsData() {
    }

    public Request getObjRequest() {
        return objRequest;
    }

    public void setObjRequest(Request objRequest) {
        this.objRequest = objRequest;
    }

    public Response getObjResponse() {
        return objResponse;
    }

    public void setObjResponse(Response objResponse) {
        this.objResponse = objResponse;
    }   

    public void toObject(String json) {
        try {
            JSONObject obj = new JSONObject(json);

            Request request = new Request();
            request.toObject(obj.getJSONObject("request").toString());
            setObjRequest(request);

            Response response = new Response();
            response.toObject(obj.getJSONObject("response").toString(), request.getRecurso());
            setObjResponse(response);

        } catch (Exception e) {
            System.out.println("Error: " + e.getMessage());
            e.printStackTrace();
        }        
    }
}
